import React, {useContext} from "react";
import {Navigate} from 'react-router-dom';
import { GlobalContext } from "./GlobalContext";

console.log(GlobalContext);


const ProtectedRouter = ({children}) => {
    const {isLogin, setIsLogin}= useContext(GlobalContext);

    if(!isLogin) {
        return <Navigate to='/login' />
    }
    return <>
        {
            children
        }
    </>
}

export default ProtectedRouter;